#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<vector>
#include<string>
using namespace std;
class LCA 
{
public:
    int getLCA(int a, int b)
    {
        while (a != b)
        {
            if (a > b)
            {
                while (a > b)
                {
                    a /= 2;
                }
            }
            if (b > a)
            {
                while (b > a)
                {
                    b /= 2;
                }
            }
        }
        return a;
        // write code here
    }
};

class Solution 
{
public:
    int buyChoco(vector<int>& prices, int money)
    {
        int min1 = prices[0], min2 = prices[1];
        if (min1 > min2)
        {
            swap(min1, min2);
        }
        int i = 0;
        for (i = 2; i < prices.size(); i++)
        {
            if (prices[i] < min2)
            {
                min2 = prices[i];
                if (min1 > min2)
                {
                    swap(min1, min2);
                }
            }
        }
        if (min1 + min2 > money)
        {
            return money;
        }
        return money - min1 - min2;
    }

    int isWinner(vector<int>& player1, vector<int>& player2)
    {
        int flag1 = 1, flag2 = 1;
        int sum1 = 0, sum2 = 0;
        int i = 0;
        for (i = 0; i < player1.size(); i++)
        {
            if (i < 2)
            {
                sum1 += player1[i];
                sum2 += player2[i];
                if (player1[i] == 10)
                {
                    flag1 = 2;
                }
                if (player2[i] == 10)
                {
                    flag2 = 2;
                }
            }
            else
            {
                sum1 += player1[i] * flag1;
                sum2 += player2[i] * flag2;
            }
        }
        if (sum1 > sum2)
        {
            return 1;
        }
        else if (sum1 < sum2)
        {
            return 2;
        }
        else
        {
            return 0;
        }
    }
};
int main()
{
    int n = 0;
    cin >> n;
    int max = 0, count = 0;
    for (int i = 0; i < 32; i++)
    {
        if (((n >> i) & 1) == 1)
        {
            count++;
        }
        else
        {
            if (count > max)
            {
                max = count;
            }
            count = 0;
        }
    }
    cout << max << endl;

    LCA a;
    cout<<a.getLCA(100, 200);
    return 0;
}

 